﻿using LYR_RPA.models.project;
using LYR_RPA.utils;
using System.Windows;
using System.Windows.Controls;

namespace LYR_RPA.pages.set
{
    /// <summary>
    /// RemoveFolderPage.xaml 的交互逻辑
    /// </summary>
    public partial class RemoveFolderPage : Page
    {
        public RemoveFolderPage()
        {
            InitializeComponent();
            FolderListView.ItemsSource = CommonUtils.ReadRemoveFolder();
        }

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var data = button.DataContext as Project;
            SQLiteApply.RemoveFolder(data);
            CommonUtils.ReadRemoveFolder();
            CommonUtils.ReadProject();
        }

        private void Copy_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var data = button.DataContext as Project;
            Clipboard.SetText(data.Path);
            // 创建消息队列
            var messageQueue = SnackbarThree.MessageQueue;

            // 显示消息
            var message = "已复制路径";
            messageQueue.Enqueue(message);
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            FolderListView.ItemsSource = CommonUtils.ReadRemoveFolder();
        }
    }
}
